<template>
  <div class="my-header">
    <div class="left">
      <slot name="left">
        <RouterLink to="/city">城市</RouterLink>
      </slot>
    </div>
    <div class="center">
      <RouterLink to="/search">卡姿兰大眼睛</RouterLink>
    </div>
    <div class="right">
      <RouterLink v-show="isLogined" to="/center">我的</RouterLink>
      <RouterLink v-show="!isLogined" to="/login">登录</RouterLink>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { toRef } from "vue";
import { useUserStore } from "@/stores/user";

const store = useUserStore();
const isLogined = toRef(store, "isLogined");
</script>

<style lang="scss" scoped>
.my-header {
  display: flex;
  align-items: center;
  height: 50px;
  background-color: #d30707;

  .left,
  .right {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    font-size: 16px;

    a {
      color: #fff;
    }
  }

  .center {
    flex: 1;
    padding-left: 16px;
    height: 36px;
    line-height: 36px;
    border-radius: 10px;
    background-color: #fff;
    font-size: 16px;

    a {
      color: #000;
    }
  }
}
</style>
